import { GlobalVar } from "../../common/globalvar";
import {CoordTRFUtil} from "../../common/tools/coordtool";
import { AuxPointDisSvcFactory } from "./auxdissvcfactory";

var DisAbsorbPointSvc = {}

DisAbsorbPointSvc.display = function (aborbInfo, map, mapInfo) {
    if (aborbInfo.display != 1) {
        return;
    }
    if (mapInfo.editMode == "autocad") {
        let subDisSvc = AuxPointDisSvcFactory.create(aborbInfo.kind);
        if (subDisSvc) {
            subDisSvc.display(aborbInfo, map, mapInfo);
        }
    }
    else {
        this.disCircleDot(aborbInfo.pt, map, mapInfo);
    }
    aborbInfo.display = 0;
}

DisAbsorbPointSvc.disCircleDot = function (pt, map, mapInfo) {
    let sp = CoordTRFUtil.world2Screen(pt, mapInfo);
    map.beginPath();
    map.ellipse(sp.x, sp.y, 5, 5, 0, 0, Math.PI * 2, false);
    map.closePath();
    map.fillStyle = GlobalVar.highlightColor.toHexString();
    map.fill();
}

export { DisAbsorbPointSvc }